package cn.glc.daily.life.common.exceptions;

import lombok.Data;

/**
 * 全局异常
 *
 * @author simon
 * @date 2020/6/2 11:53
 * @copyright:
 * @modifier
 * @motto a no talent, people who have to study hard
 */
@Data
public class GlobalException extends RuntimeException implements Business {

    private String code;
    private String msg;

    public GlobalException(String code, String msg) {
        super(msg);
        this.code = code;
        this.msg = msg;
    }

    public GlobalException(Business business) {
        super(business.msg());
        this.code = business.code();
        this.msg = business.msg();
    }

    @Override
    public String code() {
        return this.code;
    }

    @Override
    public String msg() {
        return this.msg;
    }
}
